<template>
  <div id="footprint">
    <c-title :hide="false" text="我的收藏"></c-title>
    <div class="collection-title flex-a-c flex-j-sb">
      <div>我的收藏</div>
      <div class="operate" @click="operateOn">{{checkAll?'完成':'管理'}}</div>
    </div>
    <div class="coll-48"></div>
    <div style="margin-bottom: 0.75rem" v-if="!collectStoreIs"></div>
    <van-tabs 
      :active="collectIndex" 
      @change="onStoreChange" 
      v-if="collectStoreIs" 
      title-inactive-color="#6E6E79" 
      title-active-color="#00001C"
      line-width="20px">
      <block v-for="(item, index) in collectTabs" :key="index">
        <van-tab :title="item.name"></van-tab>
      </block>
    </van-tabs>
    <div v-if="collectIndex === 0" class="collect-main">
      <div v-if="datas.length > 0">
        <div class="tbs" v-for="(item, index) in datas" :key="index" v-if="item.goods" >
          <van-swipe-cell>
            <div class="select flex-a-c" v-if="checkAll">
              <van-checkbox v-model="item.checked" checked-color="#FE5E56" @click="checkItem(index)"></van-checkbox>
            </div>
            <div class="flex" @click="toItem(item.goods)">
              <div class="li2" v-if="item.goods.thumb"><img :src="item.goods.thumb" /></div>
              <div class="li2" v-if="!item.goods.thumb"><img src="../../../assets/images/img_default.png" /></div>
              <div class="li3">
                <div class="product-name ell">{{ item.goods.title | escapeTitle }}</div>
                <p class="product-price">
                  {{ $i18n.t("money") }}
                  <span v-if="item.vip_level_status && item.vip_level_status.status == 1" class="product-price-span">{{ item.vip_level_status.word }}</span>
                  <span v-else>{{ item.goods.price }}</span>
                  <span class="s2">{{ $i18n.t("money") }}{{ item.goods.market_price }}</span>
                </p>
              </div>
            </div>
            
            <template #right>
              <van-button square type="danger" text="删除" @click="delteteItem(item, index)" />
            </template>
          </van-swipe-cell>
        </div>
      </div>
      <van-empty description="空空如也" v-else />
    </div>
    <div class="commercial-list" v-if="collectIndex === 1">
      <div v-if="commercialList.length > 0">
        <block v-for="(item, index) in commercialList" :key="index" class="commercial-block">
          <van-swipe-cell>
            <div class="commercial-item flex">
                <div class="select flex-a-c" v-if="checkAll" @click="checkItem(index)" >
                  <van-checkbox v-model="item.checked" checked-color="#FE5E56"></van-checkbox>
                </div>
                <div class="flex"  @click="commercialTo(item.id)">
                  <div class="img">
                  <img :src="item.store_logo_url" />
                  </div>
                  <div class="wrap">
                    <div class="wrap-title">{{ item.store_name }}</div>
                    <div class="mean-tag" v-if="item.average_price !== '0.00'">人均￥{{ item.average_price }}</div>
                    <div class="flex-j-sb">
                      <div class="flex wrap-tag">
                        <div>{{ item.first_category }}</div>
                        <div>{{ item.second_category }}</div>
                        <div>{{ item.third_category }}</div>
                      </div>
                    </div>
                    <div class="flex-a-c address">
                      <!-- <div class="mean-line">|</div> -->
                      <div class="address-text">{{ item.city }}{{ item.district }}{{ item.street }}{{ item.address }}</div>
                    </div>
                  </div>
                </div>
                
            </div>
            <template #right>
              <van-button square type="danger" text="删除" @click="delteteItem(item, index)" />
            </template>
          </van-swipe-cell>
          <div class="mb-10"></div>
          
          
        </block>
      </div>
      <van-empty description="空空如也" v-else />
    </div>
    <div class="mh-56"></div>
    <div class="footer-btn flex-a-c flex-j-sb" :class="[fun.isIphoneX() ? 'iphoneXStyle' : '']" v-if="checkAll">
      <div class="footer-checked">
        <van-checkbox v-model="collChecked" checked-color="#FE5E56" @click="collCheckedOn">全选</van-checkbox>
      </div>
      <div class="confrim-btn" @click="confrimOn">删除</div>
    </div>
  </div>
</template>
<script>
import collectioncontroller from "./collectioncontroller";

export default collectioncontroller;
</script>
<style lang="scss" rel="stylesheet/scss" scoped>
#appMain .collection-title,#appMain .footer-btn {
  left:auto;
}
.ell {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  /* 定义显示的行数 */
  overflow: hidden;
}
.mb-10 {
  height: 10px;
  clear: both;
}
.mh-56 {
  height: 3.5rem;
  clear: both;
}
.footer-checked ::v-deep .van-checkbox__label{
  font-size: 0.875rem;
  font-weight: 500;
  color: #00001C;
}
.coll-48 {
  height: 3rem;
  clear: both;
}
#footprint ::v-deep .van-tabs__nav {
  background-color: transparent;
}
#footprint ::v-deep .van-tabs__line {
  bottom:22px;
}
#footprint ::v-deep .van-nav-bar--fixed {
  border-bottom: none;
}
#footprint ::v-deep .van-tab--active {
  font-weight: bold;
}
.tbs ::v-deep .van-swipe-cell__right, .commercial-block ::v-deep .van-swipe-cell__right{
  right:-1px;
}
#footprint {
  .mint-cell.mint-cell-swipe,
  .mint-cell-value {
    width: 100%;
  }

  .mint-cell-value,
  .tbs {
    display: flex;
    align-items: center;
    background: #fff;
    flex-flow: row wrap;
    border-bottom: #f5f5f5 0.0625rem solid;
    // margin-bottom: 0.375rem;
    border-radius: 0.5rem 0.5rem 0.5rem 0.5rem;
    margin:0rem 0.75rem 0.625rem 0.75rem;

    .li1 {
      flex: 10%;
    }

    .li2 {
      flex: 20%;

      img {
        width: 6.25rem;
        height: 6.25rem;
        border-radius: 0.5rem;
      }
    }

    .li3 {
      flex: 60%;
      display: flex;
      flex-direction: column;
      text-align: justify;
      margin-left: 0.625rem;
      box-sizing: border-box;

      .product-name {
        // flex: 5;
        font-size: 0.875rem;
        font-weight: 500;
        color: #00001C;
        // font-weight: bold;
        text-align: justify;
        line-height: 1.125rem;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        padding:1.0625rem 0 0 0;
      }

      .product-price {
        flex: 1;
        color: #f15353;
        text-align: left;
        margin: 0;
        padding:1rem 0 0 0;
        font-size: 0.875rem;

        span {
          font-size: 1.125rem;
        }
        .s2 {
          padding:0 0 0 10px;
          color: #888;
          font-size: 12px;
          text-decoration: line-through;
          vertical-align: middle;
        }

        .product-price-span {
          font-size: 0.75rem;
          background: #f15353;
          color: white;
          padding: 0.2rem 0.5rem;
          border-top-left-radius: 0.5rem;
          border-bottom-right-radius: 0.5rem;
        }
      }
    }

    .li4 {
      flex: 10%;
    }
  }

  #foota {
    position: fixed;
    bottom: 0;
    background: #fff;
    width: 100%;
    display: flex;
    align-items: center;

    .el-checkbox {
      flex: 5;
      text-align: left;
      padding-left: 0.9375rem;
    }

    .dels {
      flex: 3;
      border-radius: 0.25rem;
      border: solid 0.0625rem red;
      background: red;
      color: #fff;
      padding: 0.625rem;
    }
  }

  .tbs,.commercial-list {
    .van-swipe-cell {
      width: 100%;
      overflow: hidden;

      ::v-deep .van-swipe-cell__wrapper {
        display: flex;
        width: 100%;
        padding: 0.625rem 0.75rem;

        .van-button {
          height: 100%;
          padding:0 0.75rem;
          // width: 16px;
          background: #f15353;
          line-height: 1.5rem;
          font-size: 0.875rem;
          border-radius: 0rem 0.5rem 0.5rem 0rem;
        }

        .van-button--danger {
          border: none;
        }
      }
    }
  }
  .commercial-list {
    position: relative;
    overflow: hidden;
    .van-swipe-cell {
      width:100%;
      overflow: hidden;
      border-radius: 0.5rem 0.5rem 0.5rem 0.5rem;
      &::v-deep .van-swipe-cell__wrapper  {
        padding:0;
      }
    }
    .commercial-block {
      width: 100%;
      overflow: hidden;
    }
  }
  
}

.b-goodsList.row {
  .main .li {
    padding: 0.625rem 3.4375rem 0.625rem 5.625rem;
  }

  .del {
    width: 1.5625rem;
    height: 5.625rem;
    position: absolute;
    padding: 0 0.625rem;
    background: #f0f0f0;
    border-left: 0.0313rem solid #d9d9d9;
    top: -0.0313rem;
    right: 0;
    z-index: 5;
    display: flex;
    align-items: center;

    .imgDel {
      width: 1.5625rem;
      height: 1.5625rem;
    }
  }
}

.s1-two {
  font-size: 0.75rem;
  background: #f15353;
  color: white;
  padding: 0.2rem 0.5rem;
  border-top-left-radius: 0.5rem;
  border-bottom-right-radius: 0.5rem;
}

.Price {
  color: #f15353;
}

.commercial-list {
  padding: 0.625rem 0.625rem 0 0.625rem;


  .look-over {
    padding: 0.9063rem 0 1.8125rem 0;
  }
}
.select {
  padding:0 0.625rem 0 0;
}

.commercial-item {
  width:100%;
  box-sizing: border-box;
  background-color: #fff;
  padding: 0.625rem;
  // margin-bottom: 0.625rem;
  // border-radius: 0.5rem 0.5rem 0.5rem 0.5rem;

  .img {
    width: 6.25rem;
    min-width: 6.25rem;
    height: 6.25rem;
    margin-right: 0.625rem;
    display: flex;
    // flex: 2;

    img {
      width: 6.25rem;
      min-width: 6.25rem;
      height: 6.25rem;
      border-radius: 0.5rem 0.5rem 0.5rem 0.5rem;
      margin:0;
    }
  }

  .wrap {
    /* flex: 3; */

    .wrap-title {
      font-size: 0.9453rem;
      color: #222;
      font-size: 1rem;
      font-weight: bold;
      color: #00001C;
      padding:0.625rem 0 0.4375rem 0;
      text-align: left;
      word-wrap:break-word;
      word-break:break-all;
    }
    .wrap-tag {
      flex-wrap: wrap;
    }
    .wrap-tag div {
      font-size: 11px;
      line-height: 11px;
      color: #3B3B4A;
      padding:3px 5px;
      background-color: #F0F0F1;
      margin: 0 0.3438rem 0 0;
      border-radius: 0.125rem 0.125rem 0.125rem 0.125rem;
    }
  }

  .distance {
    font-size: 0.6875rem;
    color: #888;

    img {
      width: 0.6875rem;
      height: 0.6875rem;
    }
  }

  .address {
    font-size: 0.6875rem;
    color: #888;

    /* align-items: center; */
    margin: 0.875rem 0 0 0;
  }
}

.wrap .mean-tag {
  font-weight: 400;
  color: #00001C;
  font-size: 0.75rem;
  line-height: 0.75rem;
  padding:0 0 0.4375rem 0;
  text-align: left;
}
.address .address-text {
  text-align: left;
  font-size: 12px;
  font-weight: 400;
  color: #6E6E79;
  line-height: 15px;
}
.mean-line {
  font-size: 0.9375rem;
  margin-right: 0.3438rem;
}
.collect-main {
  padding:0 0 2.5rem 0;
}
.collection-title {
  position: fixed;
  top:2.3125rem;
  left:0;
  background-color: #fff;
  z-index: 20;
  width:23.4375rem;
  height: 3rem;
  line-height: 3rem;
  // padding:1.0625rem 0.875rem;
  padding: 0 0 0 0.875rem;
  font-weight: 500;
  color: #00001C;
  font-size: 0.875rem;
  line-height: 0.875rem;
}
.collection-title .operate {
  cursor: pointer;
  height: 3rem;
  line-height: 3rem;
  padding:0 0.875rem;
}
.footer-btn {
  width:23.4375rem;
  position: fixed;
  bottom: 3.125rem;
  left:0;
  padding:0.625rem 0.75rem 0.625rem 0.75rem;
  background-color: #fff;
  .confrim-btn {
    font-size: 0.875rem;
    line-height: 0.875rem;
    font-weight: 400;
    color: #FFFFFF;
    padding:0.6875rem 1.75rem;
    border-radius: 1.875rem 1.875rem 1.875rem 1.875rem;
    background: #F15353;
    cursor: pointer;
  }
}
.iphoneXStyle {
  bottom: 74px;
}
</style>
